<html>
<head><meta charset="utf-8"><title>Attach GDB to x.py test · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Attach.20GDB.20to.20x.2Epy.20test.html">Attach GDB to x.py test</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="175273972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Attach%20GDB%20to%20x.py%20test/near/175273972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> achan1989 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Attach.20GDB.20to.20x.2Epy.20test.html#175273972">(Sep 09 2019 at 19:19)</a>:</h4>
<p>Hello, I'm new to hacking on the compiler.  I've got to the stage where I'm running <code>x.py test src/test/ui/whatever</code>and trying to figure out why my change to the parser isn't working properly.</p>
<p>I thought it might be helpful to step through the parser while it's building one of the test source files.  What's the best way to run an <code>x.py</code> test under a debugger?</p>



<a name="175280612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Attach%20GDB%20to%20x.py%20test/near/175280612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Attach.20GDB.20to.20x.2Epy.20test.html#175280612">(Sep 09 2019 at 20:36)</a>:</h4>
<p>I usually do something like <code>gdb --args ./build/x86_64-pc-windows-gnu/stage1/bin/rustc src/test/ui/name.rs</code>, but that becomes more annoying when there are dependencies in <code>auxiliary</code>, so integrating that into <code>x.py test</code> would be really great.</p>



<a name="175280791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Attach%20GDB%20to%20x.py%20test/near/175280791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Attach.20GDB.20to.20x.2Epy.20test.html#175280791">(Sep 09 2019 at 20:38)</a>:</h4>
<p>btw, I wonder if this is explained on rustc-guide, because otherwise seems like an interesting thing to explain</p>



<a name="175281773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Attach%20GDB%20to%20x.py%20test/near/175281773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> achan1989 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Attach.20GDB.20to.20x.2Epy.20test.html#175281773">(Sep 09 2019 at 20:49)</a>:</h4>
<p>As far as I could see, the rustc-guide only mentions using backtraces or debug logging.<br>
<span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> I did wonder about that, but I was worried that x.py includes lots of compiler flags etc.  It's good to hear that the simple version can work -- I will try that, thanks.</p>



<a name="175282242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Attach%20GDB%20to%20x.py%20test/near/175282242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Attach.20GDB.20to.20x.2Epy.20test.html#175282242">(Sep 09 2019 at 20:55)</a>:</h4>
<p><a href="https://github.com/rust-lang/rustc-guide/issues/443" target="_blank" title="https://github.com/rust-lang/rustc-guide/issues/443">https://github.com/rust-lang/rustc-guide/issues/443</a> :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>